home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Source Code
/
Libraries
/
Graphic Elements 3
/
GESound
/
GESound README
next >
Wrap
Text File
|
1995-05-25
|
4KB
|
130 lines
GESound Module
An asynchronous sound player for use with Graphic Elements
Copyright 1995 by Al Evans. All rights reserved.
-----
The GESound module strives to provide an application program interface to asynchronous sound
playback which is as easy to use as the Graphic Elements API itself.
At startup, the application program initializes the module by requesting a GESoundsRec
initialized for the maximum number of sounds it will play at the same time.
GESoundPtr GEInitSounds(short nSoundChannels);
Where
- nSoundChannels is the maximum number of sounds which will play simultaneously.
-----
Once each time through the main event loop, the application passes this record to
GESoundMaintenance(). This routine starts any sounds scheduled to begin "now", and
cleans up after any sounds which have finished playing.
void GESoundMaintenance(GESoundPtr sounds);
Where
- sounds is a pointer to a GESoundsRec obtained by calling GEInitSounds().
-----
To play a sound, the application program calls GEScheduleSound(), passing it the resource
number of the 'snd ' resource it wishes to play, the number of milliseconds to wait before
playing the sound, and the priority level of the request. If too many sounds are scheduled
for the number of channels available, those with higher priorities take precedence.
OSErr GEScheduleSound(GESoundPtr sounds, short sndResID, short priority,
unsigned long msDelay);
Where
- sounds is a pointer to a GESoundsRec obtained by calling GEInitSounds(),
- sndResID is the number of the 'snd ' resource the application wishes to play,
- priority is a number representing how "important" this sound is to the application,
- msDelay is the number of milliseconds from the time GEScheduleSound() is called
to wait before playing the sound.
-----
When it is completely finished playing sounds, the application calls GEDisposeSounds() to
free all memory, sound channels, and other resources used by the GESound module.
void GEDisposeSounds(GESoundPtr sounds);
Where
- sounds is a pointer to a GESoundsRec obtained by calling GEInitSounds().
----
The GESounds module also includes calls to permit the application program to control
and obtain information about sound playback.
Playback can be enabled and disabled for an entire GESoundsRec, for example in response
to the user's selection of a menu item.
void GEnableSound(GESoundPtr sounds, Boolean enableIt);
Where
- sounds is a pointer to a GESoundsRec obtained by calling GEInitSounds().
-----
The data for a particular sound can be locked in memory (when it is likely to be used
repeatedly) or made purgeable (when the likelihood of repeated use has ended).
void GEHoldSound(GESoundPtr sounds, short sndResID, Boolean keepInMemory);
Where
- sounds is a pointer to a GESoundsRec obtained by calling GEInitSounds(),
- keepInMemory is true to lock the sound data in memory or false to make it purgeable.
-----
The application program can determine whether a specified sound is currently being played.
Boolean GESoundPlaying(GESoundPtr sounds, short sndResID);
Where
- sounds is a pointer to a GESoundsRec obtained by calling GEInitSounds(),
- sndResID is the resource number of the sound for which information is desired.
-----
The application program can stop the playback of a specified sound.
void GEStopOneSound(GESoundPtr sounds, short sndResID);
Where
- sounds is a pointer to a GESoundsRec obtained by calling GEInitSounds(),
- sndResID is the resource number of the sound which is to be stopped.
-----
The application program can stop all sounds which are currently playing. (This is
done automatically if the program calls GEnableSound() with enableIt == false).
void GEStopAllSounds(GESoundPtr sounds);
Where
- sounds is a pointer to a GESoundsRec obtained by calling GEInitSounds().